﻿class FakeGrid extends BaseGrid {
    GetCellRaw(x: number, y: number) {
        return this.cells[x + y * this.Width];
    }
    GetCell(x: number, y: number) {
        return this.GetCellRaw(x, y);
    }
    GenerateContent() {
        for (var x = 1; x < this.Width - 1; x++) {
            for (var y = 1; y < this.Height - 1; y++) {
                this.GetCellRaw(x, y).CalculateNextState();
            }
        }

        for (var i = 0; i < this.GetNrOfCells();i++) 
            this.cells[i].TakeOverNextState();
        
    }
   

    NrOfIteration: number;

    cells: Array<ICell>;
    constructor(width: number, height: number, ...args: CellState[]) {
        super();
        this.Width = width;
        this.Height = height;
        this.cells = new Array<ICell>(this.Width * this.Height);

        for (var x = 0; x < this.Width; x++) {
            for (var y = 0; y < this.Height; y++) {
                var i = x + y * this.Width;
                this.cells[i] = new DefaultCell();
                this.cells[i].InitCell(this, args[i], x, y);
            }
        }
    }

}

